package com.boot.springboot.pojo.dto;

import jakarta.persistence.Column;
import jakarta.validation.constraints.*;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.NumberFormat;

public class UserDto {
    @NotNull(message = "id不能为空")
    @Min(value =10000, message = "商品ID至少10000以上") // 最小10000（5位）
    @Max(value =100000, message = "商品ID最多100000以下") // 最大100000（6位）
    private Integer userId;
    @NotBlank(message = "名字不能为空")
    private String userName;
    @NotBlank(message = "性别不能为空")
    private String userSex;
    @NotNull(message = "账号不能为空")
    @Min(value =1000000000, message = "至少10位")
    @Min(value =999999999, message = "最多10位")
    private Integer userAccount;
    @NotBlank(message = "密码不能为空")
    @Length(min = 6,max=12)
    private String userPassword;
    @Pattern(regexp = "^\\d{11}$", message = "手机号必须为11位数字")
    private String userPhone;
    @Email(message="邮箱格式不正确")
    private String userEmail;

    public String getUserName() {return userName;}

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public  Integer getUserId() {
        return userId;
    }

    public void setUserId( Integer id) {this.userId= id;}

    public  String getUserSex() {return userSex;}

    public void setUserSex( String userSex) {this.userSex = userSex;}

    public  Integer getUserAccount() {return userAccount;}

    public void setUserAccount(Integer userAccount) {this.userAccount = userAccount;}

    public  String getUserPassword() {return userPassword;}

    public void setUserPassword(String userPassword) {this.userPassword = userPassword;}

    public String getUserPhone() {return userPhone;}

    public void setUserPhone( String userPhone) {this.userPhone = userPhone;}

    public  String getUserEmail() {return userEmail;}

    public void setUserEmail( String userEmail) {this.userEmail = userEmail;}

    @Override
    public String toString() {
        return "UserDto{" +
                "userId=" + userId +
                ", userName='" + userName + '\'' +
                ", userSex='" + userSex + '\'' +
                ", userAccount=" + userAccount +
                ", userPassword='" + userPassword + '\'' +
                ", userPhone='" + userPhone + '\'' +
                ", userEmail='" + userEmail + '\'' +
                '}';
    }
}
